<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <form id="mainForm" action="" method="post">
        <div style="margin: 20px 5px;">
            协议标题:&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="title" id="title" value="{$find.title}">
        </div>
        <div style="margin: 0 0 20px 5px;">
            协议内容:<script id="container" name="content" type="text/plain">{$find.content}</script>
        </div>
        <!--<div style="margin: 0 0 0 5px;">-->
            <!--状态:&nbsp;&nbsp;&nbsp;&nbsp;-->
            <!--<input type="checkbox" name="state" value="1" id="state"/>显示-->
        <!--</div>-->
        <div style="margin: 20px 0 0 5px;">
            <input id="updateGoods" type="submit" value="提交"  style="background: #63B8FF;color: white;border: 0;width: 60px;height: 30px;font-size: 17px;;"/>
        </div>
        <input type="hidden" value="{$find.id}" id="idd">
    </form>
    <!-- 配置文件 -->
    <script type="text/javascript" src="__PUBLIC__/ueditor/ueditor.config.js"></script>
    <!-- 编辑器源码文件 -->
    <script type="text/javascript" src="__PUBLIC__/ueditor/ueditor.all.js"></script>
    <!-- 实例化编辑器 -->
    <script type="text/javascript">
        var editor = UE.getEditor('container');
    </script>
    <script src="__PUBLIC__/js/jquery-1.11.1.min.js" charset="utf-8"></script>
    <script>
        $(function(){
            var editor = UE.getEditor('container');
            $('#updateGoods').click(function(){
                $.ajax({
                    type: "POST",
                    url: "save_agreement_shop",
                    data: {id:$('#idd').val(), title:$('#title').val(), content: editor.getContent()},
                    dataType: "json",
                    success: function(res) {
                        if (res == 1) {
                            alert('提交成功!')
                            parent.location.reload();
                        } else {
                            alert('提交失败!')
                            parent.location.reload();
                        }
                    },
                    error: function(res) {
                        alert('提交错误!');
                        parent.location.reload();
                    }
                });
            });
        });
    </script>
</body>
</html>